package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	[Bindable]
	public class LocatingRuleDetailDO
	{
		public var LOCATING_RULE:String = "";
		public var QUANTITY_UM:String = "";
		public var SEQUENCE:String = "";
		public var STRATEGY:String = "";
		public var SPLIT_QTY:String = "N";
		public var LOC_SEL_ID:Number = 0;
		public var LOC_SEL_NAME:String = "";
		public var OBJECT_ID:Number = 0;

		public function LocatingRuleDetailDO()
		{
		}
	
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
				<LOCATING_RULE_DETAIL>
					<LOCATING_RULE>{LOCATING_RULE}</LOCATING_RULE>
					<QUANTITY_UM>{QUANTITY_UM}</QUANTITY_UM>
					<SEQUENCE>{SEQUENCE}</SEQUENCE>
					<STRATEGY>{STRATEGY}</STRATEGY>
					<SPLIT_QTY>{SPLIT_QTY}</SPLIT_QTY>
					<LOC_SEL_ID>{LOC_SEL_ID}</LOC_SEL_ID>
					<LOC_SEL_NAME>{LOC_SEL_NAME}</LOC_SEL_NAME>
					<OBJECT_ID>{OBJECT_ID}</OBJECT_ID>
				</LOCATING_RULE_DETAIL>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:LocatingRuleDetailDO = new LocatingRuleDetailDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}